﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Home.Haushalt.Lib;
using Home.Haushalt.Lib.Element;

namespace Home.Haushalt.Gui
{
    /// <summary>
    /// 
    /// </summary>
    public partial class FrmPropertyOpponent : FrmProperty
    {
        /// <summary>
        /// 
        /// </summary>
        public FrmPropertyOpponent()
        {
            InitializeComponent();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void FrmPropertyOpponent_Load(object sender, EventArgs e)
        {
            int opponentId = ElementObject.Row[Opponent.Fields.Id].ToInt();
            opponentId = (opponentId > 0) ? opponentId : -1;

            //Tab Parentposten
            this.AddTab(Posten.ElementType, Posten.Fields.OpponentId, opponentId);

            //Tab Documenten
            this.AddTab(Document.ElementType, Document.Fields.OpponentId, opponentId);

            //Tab Documenten
            this.AddTab(Date.ElementType, Document.Fields.OpponentId, opponentId);

            //Tab Members
            this.AddTab(Member.ElementType, Member.Fields.OpponentId, opponentId);

            //Binding
            AddBinding(txtNachname.DataBindings, "Text", Opponent.Fields.Name);
            AddBinding(txtVorname.DataBindings, "Text", Opponent.Fields.Zusatzname);
            AddBinding(txtIdent.DataBindings, "Text", Opponent.Fields.Ident);

            lstOpponenttype.AddBinding(_elementObject, Opponent.Fields.OpponentTypeId);

            DataBind();
        }

    }
}
